<template>
  <div id="app">

    <v-loading :loadingmessage='loadingmessage' :loadingFlag='loadingFlag' :imgF='imgF'></v-loading>
    <v-header v-show="flag1"></v-header>
    <v2-header v-show="flag2"></v2-header>
    <router-view/>
  </div>
</template>

<script>
import $ from "jquery";
import chief from "./components/chief.vue";
import chief2 from "./components/chief2.vue";
import loading from "./components/common/loading.vue";
import { Message } from "element-ui";

export default {
  name: "App",
  data() {
    return {
      flag1: false,
      flag2: false,
      loadingmessage: "xxxxxx",
      loadingFlag: false,
      imgF: true
    };
  },
  components: {
    "v-header": chief,
    "v2-header": chief2,
    "v-loading": loading
  },
  mounted() {
    $("#app").height($(document.body).height() - 66);
    if (
      !u.getStore("user") &&
      this.$route.path !== "/register" &&
      this.$route.path !== "/login" &&
      this.$route.path !== "/forget" &&
      this.$route.path !== "/"
    ) {
      Message({
        message: "登录失效",
        type: "error"
      });
      this.$router.push({ path: "/login" });
    }
  },
  watch: {

  },
  methods: {
    loading(obj) {
      this.loadingmessage = obj.message;
      this.loadingFlag = true;
      this.imgF = obj.type;
    }
  }
};
</script>

<style lang='less'>
body,
html {
  width: 100vw;
  height: 100vh;
  overflow-x: hidden;
  // &::-webkit-scrollbar {
  //   background-color: #ccc;
  //   width: 65px;
  // }
}
#app {
  width: 100%;
  height: 100%;
}
</style>
